package trb.complexshield.bool.visualisation;

import javax.media.j3d.Appearance;
import javax.media.j3d.BranchGroup;
import javax.media.j3d.PolygonAttributes;
import javax.media.j3d.Shape3D;
import no.hrp.hvrc.utils.j3d.SGUtils;

public class VisualisationUtils {
    public static void toWireframe(BranchGroup bg) {
        for (Shape3D shape3D : SGUtils.getNodesByType(bg, Shape3D.class)) {
            Appearance appearance = shape3D.getAppearance();
            if (appearance == null) {
                appearance = new Appearance();
                shape3D.setAppearance(appearance);
            }

            PolygonAttributes polygonAttributes = appearance.getPolygonAttributes();
            if (polygonAttributes == null) {
                polygonAttributes = new PolygonAttributes();
            }
            polygonAttributes.setPolygonMode(PolygonAttributes.POLYGON_LINE);
            appearance.setPolygonAttributes(polygonAttributes);
        }
    }
}
